import moment from "moment";
import { getRedisClient } from "../library/redis";
import { getRankDetail } from "./getRankDetail";
import { findAll } from "./mongoUtil";
import _ from 'lodash'
(async () => {
    const reids = getRedisClient()
    console.log(moment('2021-04-13','YYYY-MM-DD').unix())
    const a = await findAll('t_liver_gift_water', {
        timestamp: {
            $gte: moment('2021-05-10','YYYY-MM-DD').unix()*1000
        }
    })
    let tt = 0
    a.map(e => {
        tt += e.value
    })
    const m = _.groupBy(a,'user.nickname')
    for(const r in  m){
        let price = 0
        m[r].map(e=>{
            price+=e.value
        })
        console.log(r,price/10000)
    }
    const rank = await getRankDetail()
   // console.log(m)
    console.log(rank)
})()
